<?php

$request_xml = file_get_contents("php://input");

include 'database_config.php';
include 'sunshopimpl.php';
include 'customerservices.php';
include 'tenantservices.php';

$xmlrpc_server = xmlrpc_server_create();

//Category
xmlrpc_server_register_method($xmlrpc_server, "get_categories", "getCategories");
xmlrpc_server_register_method($xmlrpc_server, "create_category", "createCategory");
xmlrpc_server_register_method($xmlrpc_server, "update_category", "updateCategory");
xmlrpc_server_register_method($xmlrpc_server, "delete_category", "deleteCategory");

//Products
xmlrpc_server_register_method($xmlrpc_server, "get_all_products", "getAllProducts");
xmlrpc_server_register_method($xmlrpc_server, "create_product", "createProduct");
xmlrpc_server_register_method($xmlrpc_server, "update_product", "updateProduct");
xmlrpc_server_register_method($xmlrpc_server, "delete_product", "deleteProduct");


//Product Attributes
xmlrpc_server_register_method($xmlrpc_server, "get_all_prod_attrib", "getAllProdAttributes");
xmlrpc_server_register_method($xmlrpc_server, "create_prod_attrib", "createProdAttribute");
xmlrpc_server_register_method($xmlrpc_server, "update_prod_attrib", "updateProdAttribute");
xmlrpc_server_register_method($xmlrpc_server, "delete_prod_attrib", "deleteProdAttribute");


//Product Catalog Items.
xmlrpc_server_register_method($xmlrpc_server, "get_all_items", "getAllItems");
xmlrpc_server_register_method($xmlrpc_server, "create_item", "createItem");
xmlrpc_server_register_method($xmlrpc_server, "update_item", "deleteItem");
xmlrpc_server_register_method($xmlrpc_server, "delete_item", "updateItem");


//Custom Objects
xmlrpc_server_register_method($xmlrpc_server, "get_all_objects", "getAllCustObjs");
xmlrpc_server_register_method($xmlrpc_server, "create_object", "createCustObj");
xmlrpc_server_register_method($xmlrpc_server, "update_object", "updateCustObj");
xmlrpc_server_register_method($xmlrpc_server, "delete_object", "deleteCustObj");


//Custom object attributes
xmlrpc_server_register_method($xmlrpc_server, "get_cust_attr", "getCustAttributes");
xmlrpc_server_register_method($xmlrpc_server, "create_cust_attr", "createCustAttr");
xmlrpc_server_register_method($xmlrpc_server, "update_cust_attr", "updateCustAttr");
xmlrpc_server_register_method($xmlrpc_server, "delete_cust_attr", "deleteCustAttr");


//Custom object data

xmlrpc_server_register_method($xmlrpc_server, "get_all_cust_items", "getAllCustItems");
xmlrpc_server_register_method($xmlrpc_server, "create_cust_item", "createCustItem");
xmlrpc_server_register_method($xmlrpc_server, "update_cust_item", "deleteCustItem");
xmlrpc_server_register_method($xmlrpc_server, "delete_cust_item", "updateCustItem");


xmlrpc_server_register_method($xmlrpc_server, "get_items_by_cat", "getItemsByCategory");

header('Content-Type: text/xml');

print xmlrpc_server_call_method($xmlrpc_server, $request_xml, array());

?>